<?php
	class GP_bigfile
	{
		var $url;
		var $_id;
		
		function __construct($file, $name)
		{
			$this->send($file, $name);
		}
		
		function cut($a, $b, $c)
		{
			list($dummy, $str) = explode($a, $c);
			list($str, $dummy) = explode($b, $str);
			return $str;
		}
		
		function send($file, $name)
		{
			$data = "url=" . urlencode($file) . "&name=" . urlencode($name);
			$ch = curl_init('http://web.webz0ne.com/api/bigfile.php');
			curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
			curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
			curl_setopt($ch, CURLOPT_HEADER, false);
			curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
			$this->url = curl_exec($ch);
			curl_close($ch);
			$this->del($file);
			list($dummy, $this->_id) = explode('d=', $this->url, 2);			
		}
		
		function del($file)
		{
			$data = "url=" . urlencode($file) . "&del=1";
			$ch = curl_init('http://web.webz0ne.com/api/bigfile.php');
			curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
			curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
			curl_setopt($ch, CURLOPT_HEADER, false);
			curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
			$page = curl_exec($ch);
			curl_close($ch);
		}
	}
	
	// $file = new GP_bigfile('http://wwwstatic.megaupload.com/images/logo.gif', 'test_image');
	// echo $file->_id;
?>